GBML manual / Events

step_begin

Runs every unpaused frame, before alarms and button events (S2.10 step 1).

Syntax

step_begin: fires every unpaused frame, first

Description

Runs every unpaused frame, first - before alarms, before button events, and before Step. Anything another event this same frame needs to read as "this frame's starting state" (a value captured before input or timers can change it) belongs here rather than in Step, where alarms and button presses have already had a chance to run first.

See The order of a frame for exactly where this sits among the other nine steps.

Example

A per-frame flag like this is still an instance variable, so it starts out declared in Create (see Variables, types and scope):

frame_moved = false;

Then, in Step Begin itself, the exact same line resets it fresh every frame:

frame_moved = false;

Ready for Step to set frame_moved true only if this instance actually moves, before any of this frame's own logic runs.

See also: stepstep_endThe order of a frameEvents